var foo = /^abc[]/;
var foo = /foo[]bar/;
if (foo.match(/^abc[]/)) {}
if (/^abc[]/.test(foo)) {}
var foo = /[]]/;
var foo = /\\[[]/;
var foo = /\\[\\[\\]a-z[]/;
var foo = /[]]/d;
var foo = /[(]\\u{0}*[]/u;
var foo = /[]/v;
var foo = /[[]]/v;
var foo = /[[a][]]/v;
var foo = /[a[[b[]c]]d]/v;
var foo = /[a--[]]/v;
var foo = /[[]--b]/v;
var foo = /[a&&[]]/v;
var foo = /[[]&&b]/v;

/^abc[]/.test("abcdefg"); // false
"abcdefg".match(/^abc[]/); // null

/^abc[[]]/v.test("abcdefg"); // false
"abcdefg".match(/^abc[[]]/v); // null

/^abc[[]--[x]]/v.test("abcdefg"); // false
"abcdefg".match(/^abc[[]--[x]]/v); // null

/^abc[[d]&&[]]/v.test("abcdefg"); // false
"abcdefg".match(/^abc[[d]&&[]]/v); // null

const regex = /^abc[d[]]/v;
regex.test("abcdefg"); // true, the nested `[]` has no effect
"abcdefg".match(regex); // ["abcd"]
regex.test("abcefg"); // false, the nested `[]` has no effect
"abcefg".match(regex); // null
regex.test("abc"); // false, the nested `[]` has no effect
"abc".match(regex);